package Task24;

import java.io.FileNotFoundException;
import java.util.ArrayList;

import org.apache.log4j.Logger;

import Task24.Controller.FileAlreadyExistException;

public class CMD {
	public static final Logger Log = Logger.getLogger(CMD.class);

	public static void main(String[] args) {
		System.out.println("MyCMD start...");
		Log.info("");
		Log.info("----MyCMD start in console...----");
		Controller myController = new Controller();
		ArrayList<String> result = null;

		while (true) {
			try {
				try {
					result = myController.prompt();
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			} catch (FileAlreadyExistException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			printResult(result);
		}

	}

	public static void printResult(ArrayList<String> str) {
		String aResult[] = new String[str.size()];
        str.toArray(aResult);
        for(int i=0; i<aResult.length;i++){
        	System.out.println(aResult[i]);
        }
        
	}

}
